const mysql = require('mysql2');
const appSetting = require('../utils/appSetting');
const mysqlPool = mysql.createPool(appSetting.dbconfig);

const db = {
    query:(sql, ...params)=>{
       return new Promise((reslove,reject)=>{
           mysqlPool.query(sql,params,(err,result)=>{
              if(err){
                reslove(null)
              }else{
                reslove(result);
              }
           })
       })
    }
}

module.exports=db;

